package com.learn.tx.annotation;

import com.learn.tx.annotation.aspectj.test.TestBean;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.NameMatchMethodPointcut;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.transaction.annotation.EnableTransactionManagement;


@EnableAspectJAutoProxy
@Configuration
@EnableTransactionManagement //开启基于注解的声明式事务
@ComponentScan("com.learn.tx.annotation")
public class TxAndAspectjConfig { //源码里在 AbstractAutoProxy#wrapIfNecessary() 中成为 advisedBeans集合 中的bean，不需要代理。

	@Bean
	public TestBean testBean(){
		return new TestBean();
	}
}
